﻿using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XW.Core;

namespace XW.Data;

/// <summary>
/// 组织机构实体
/// </summary>
[SugarTable(null, TableDescription = "组织机构表")]
public class SysOrg : EntityBase
{
    /// <summary>
    /// 父Id
    /// </summary>
    [JsonConverter(typeof(LongJsonConverter))]
    [SugarColumn(ColumnDescription = "父Id")]
    public long ParentId { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [SugarColumn(ColumnDescription = "名称", Length = 64)]
    [Required, MaxLength(64)]
    public virtual string Name { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    [SugarColumn(ColumnDescription = "编码", Length = 64)]
    [MaxLength(64)]
    public string Code { get; set; }


    /// <summary>
    /// 机构类型
    /// </summary>
    [SugarColumn(ColumnDescription = "机构类型", Length = 64)]
    [MaxLength(64)]
    public string OrgType { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    [SugarColumn(ColumnDescription = "排序")]
    public int Sort { get; set; } = 100;

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnDescription = "备注", Length = 128)]
    [MaxLength(128)]
    public string Remark { get; set; }

    /// <summary>
    /// 状态 0 启用 1 禁用
    /// </summary>
    [SugarColumn(ColumnDescription = "状态 0 启用 1 禁用", IsNullable = true, DefaultValue = "0")]
    public virtual int Status { get; set; }
}
